package evolution.data;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

public class CoevolutionDataBean {
	private int populationsCount = 2;
	private int populationSize = 30;
	private int epochLength = 300;
	private Problem problem = Problem.RASTRIGIN;
	private Reproduction reproduction = Reproduction.BLXa;
	private double reproductionProbability = 0.6;
	private Mutation mutation = Mutation.UNIFORM;
	private double mutationProbability = 0.004; // 0.009 for easier <60
												// dimensions problems is
												// much better
	private Selection selection = Selection.TOURNAMENT;
	private Stop stop = Stop.TIME;
	private int stopParameter = 2;
	private Migration migration = Migration.ONE_SIDED_CIRCLE;
	private int dimensions = 80;
	private int migrationParameter = 2;
	private Succession succession = Succession.BEST;
	private Initialization initialization = Initialization.RANDOM;

	private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
			this);

	public void addPropertyChangeListener(PropertyChangeListener listener) {
		changeSupport.addPropertyChangeListener(listener);
	}

	public void removePropertyChangeListener(PropertyChangeListener listener) {
		changeSupport.removePropertyChangeListener(listener);
	}

	public int getPopulationsCount() {
		return populationsCount;
	}

	public void setPopulationsCount(int populationsCount) {
		int oldValue = this.populationsCount;
		this.populationsCount = populationsCount;
		changeSupport.firePropertyChange("populationsCount", oldValue,
				populationsCount);
	}

	public int getPopulationSize() {
		return populationSize;
	}

	public void setPopulationSize(int populationSize) {
		int oldValue = this.populationSize;
		this.populationSize = populationSize;
		changeSupport.firePropertyChange("populationSize", oldValue,
				populationSize);
	}

	public int getEpochLength() {
		return epochLength;
	}

	public void setEpochLength(int epochLength) {
		int oldValue = this.epochLength;
		this.epochLength = epochLength;
		changeSupport.firePropertyChange("epochLength", oldValue, epochLength);
	}

	public Problem getProblem() {
		return problem;
	}

	public void setProblem(Problem problem) {
		Problem oldValue = this.problem;
		this.problem = problem;
		changeSupport.firePropertyChange("problem", oldValue, problem);
	}

	public Initialization getInitialization() {
		return initialization;
	}

	public void setInitialization(Initialization initialization) {
		Initialization oldValue = this.initialization;
		this.initialization = initialization;
		changeSupport.firePropertyChange("initialization", oldValue,
				initialization);
	}

	public Reproduction getReproduction() {
		return reproduction;
	}

	public void setReproduction(Reproduction reproduction) {
		Reproduction oldValue = this.reproduction;
		this.reproduction = reproduction;
		changeSupport
				.firePropertyChange("reproduction", oldValue, reproduction);
	}

	public Mutation getMutation() {
		return mutation;
	}

	public void setMutation(Mutation mutation) {
		Mutation oldValue = this.mutation;
		this.mutation = mutation;
		changeSupport.firePropertyChange("mutation", oldValue, mutation);
	}

	public Selection getSelection() {
		return selection;
	}

	public void setSelection(Selection selection) {
		Selection oldValue = this.selection;
		this.selection = selection;
		changeSupport.firePropertyChange("selection", oldValue, selection);
	}

	public Succession getSuccession() {
		return succession;
	}

	public void setSuccession(Succession succession) {
		Succession oldValue = this.succession;
		this.succession = succession;
		changeSupport.firePropertyChange("succession", oldValue, succession);
	}

	public Stop getStop() {
		return stop;
	}

	public void setStop(Stop stop) {
		Stop oldValue = this.stop;
		this.stop = stop;
		changeSupport.firePropertyChange("stop", oldValue, stop);
	}

	public Migration getMigration() {
		return migration;
	}

	public void setMigration(Migration migration) {
		Migration oldValue = this.migration;
		this.migration = migration;
		changeSupport.firePropertyChange("migration", oldValue, migration);
	}

	public int getDimensions() {
		return dimensions;
	}

	public void setDimensions(int dimensions) {
		int oldValue = this.dimensions;
		this.dimensions = dimensions;
		changeSupport.firePropertyChange("dimensions", oldValue, dimensions);
	}

	public int getMigrationParameter() {
		return migrationParameter;
	}

	public void setMigrationParameter(int migrationParameter) {
		int oldValue = this.migrationParameter;
		this.migrationParameter = migrationParameter;
		changeSupport.firePropertyChange("migrationParameter", oldValue,
				migrationParameter);
	}

	public int getStopParameter() {
		return stopParameter;
	}

	public void setStopParameter(int stopParameter) {
		int oldValue = this.stopParameter;
		this.stopParameter = stopParameter;
		changeSupport.firePropertyChange("stopParameter", oldValue,
				stopParameter);
	}

	public double getReproductionProbability() {
		return reproductionProbability;
	}

	public void setReproductionProbability(double reproductionProbability) {
		double oldValue = this.reproductionProbability;
		this.reproductionProbability = reproductionProbability;
		changeSupport.firePropertyChange("reproductionProbability", oldValue,
				reproductionProbability);
	}

	public double getMutationProbability() {
		return mutationProbability;
	}

	public void setMutationProbability(double mutationProbability) {
		double oldValue = this.mutationProbability;
		this.mutationProbability = mutationProbability;
		changeSupport.firePropertyChange("mutationProbability", oldValue,
				mutationProbability);
	}
}
